/*
 * PagosContribuyentesFijosFrame.java
 *
 * Created on 13 de abril de 2008, 11:44 AM
 */
package org.contabilidad.recibos.generales;

import org.mybeans.Sesion;

 
import org.mybeans.RecibesBeans;
import org.mybeans.RecibesDetallesBeans;

import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;

/**
 *
 * @author  avbravo
 */
public class VerDetallesRecibosFrame extends javax.swing.JFrame {

    boolean focoContribuyente = false;
    String reportSource;
    String reportDest;
    Sesion sesion;
    RecibesBeans recibesBeans;
    RecibesDetallesBeans recibesDetallesBeans;
    int fila = -1;
    DefaultTableModel modelo;
    private int AnioRecibo;
    private int NumeroMes;
    String Cedula;
    String TipoId = "";
    private String idRegimen;
    String sql;
    String rowIdRegimen;
    String rowRegimen;
    double rowValor;
    double rowPago;
    int rowCantidad;
    double rowExoneracion;
    double rowSaldo;
    double rowSaldoAnterior;
    String rowEsRecargo;
    String rowComentario;
    String rowEstatus;
    String rowPeriodo;
    double rowSoloMorosidad;
    double Pago = 0;
    double Exoneracion = 0;
    double Valor = 0.0;
    double Saldo = 0.0;
    double SaldoAnterior = 0.0;
    int IdRecibo = 0;
    Double TotalPagado = 0.0;
    Double TotalExonerado = 0.0;
    String idExoneracion = "";
    Double Deuda;
    boolean TieneExoneracion = false;
    boolean TieneAlgunRegistroMoroso = false;
    String Estatus;
    int n;
    int paginas;

    /** Creates new form */
    public VerDetallesRecibosFrame() {
        initComponents();
        sesion = new Sesion();
        /*
         * Fondo
         */

         
         
         

        jPanelFondo.setOpaque(false);
        setContentPane(jPanelFondo);
        /*
         * fondo
         */

        recibesBeans = new RecibesBeans();
        recibesDetallesBeans = new RecibesDetallesBeans();

        java.util.Calendar ca = java.util.Calendar.getInstance();
        java.sql.Date mydate = new java.sql.Date(ca.getTimeInMillis());
        jFormattedTextFieldFecha.setValue(mydate);


        this.AnioRecibo = ca.get(java.util.Calendar.YEAR);
        NumeroMes = ca.get(java.util.Calendar.MONTH);

        sesion.setAnioRecibo(AnioRecibo);
        sesion.setNumeroMesRecibo(NumeroMes);
        //
        modelo = (DefaultTableModel) jXTable1.getModel();

        modelo.isCellEditable(1, 1);
        TableColumn columnCheckBox = jXTable1.getColumnModel().getColumn(0);
        columnCheckBox.setPreferredWidth(2);

        TableColumn columnId = jXTable1.getColumnModel().getColumn(1);
        columnId.setPreferredWidth(130);

        TableColumn columnRegimen = jXTable1.getColumnModel().getColumn(2);
        columnRegimen.setPreferredWidth(130);



        jTextFieldTotalExonerado.setText("");
        jTextFieldTotalPago.setText("");




    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanelFondo = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jTextFieldRecibo = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jFormattedTextFieldFecha = new javax.swing.JFormattedTextField();
        jButtonRegresar = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jTextFieldIdPagador = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextFieldNombrePagador = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jXTable1 = new org.jdesktop.swingx.JXTable();
        jLabel18 = new javax.swing.JLabel();
        jTextFieldTotalPago = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTextFieldTotalExonerado = new javax.swing.JTextField();
        jButtonLimpiar = new javax.swing.JButton();
        jButtonRegresar2 = new javax.swing.JButton();
        jTextFieldExoneracion = new javax.swing.JTextField();
        jTextFieldTipoRecibo = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTextFieldNombreFuncionario = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("VER DETALLES DE RECIBOS");
        addWindowFocusListener(new java.awt.event.WindowFocusListener() {
            public void windowGainedFocus(java.awt.event.WindowEvent evt) {
                formWindowGainedFocus(evt);
            }
            public void windowLostFocus(java.awt.event.WindowEvent evt) {
            }
        });

        jPanelFondo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanelFondo.setOpaque(false);

        jLabel2.setText("Recibo");

        jTextFieldRecibo.setToolTipText("Numero de recibo");
        jTextFieldRecibo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldReciboActionPerformed(evt);
            }
        });

        jLabel3.setText("Fecha");

        jFormattedTextFieldFecha.setEditable(false);
        jFormattedTextFieldFecha.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("dd/MM/yyyy"))));
        jFormattedTextFieldFecha.setToolTipText("Fecha");
        jFormattedTextFieldFecha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jFormattedTextFieldFechaActionPerformed(evt);
            }
        });

        jButtonRegresar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gif/regresar.jpeg"))); // NOI18N
        jButtonRegresar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRegresarActionPerformed(evt);
            }
        });

        jLabel4.setText("Por");

        jTextFieldIdPagador.setColumns(35);
        jTextFieldIdPagador.setToolTipText("Cedula del contribuyente");
        jTextFieldIdPagador.setEnabled(false);
        jTextFieldIdPagador.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldIdPagadorControlActionPerformed(evt);
            }
        });
        jTextFieldIdPagador.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextFieldIdPagadorKeyPressed(evt);
            }
        });

        jLabel5.setText("Tipo");

        jTextFieldNombrePagador.setColumns(70);
        jTextFieldNombrePagador.setEnabled(false);

        jLabel1.setText("Exoneracion");

        jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jXTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                ".", "Codigo", "Regimen", "Deuda", "Cantidad", "Pago", "Saldo", "Exoneracion", "Estatus", "Periodo", "Valor", "Morosidad", "Comentario"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Boolean.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class, java.lang.Integer.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class, java.lang.Double.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                true, false, false, false, false, false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jXTable1.setOpaque(false);
        jScrollPane2.setViewportView(jXTable1);

        jLabel18.setText("Total");

        jTextFieldTotalPago.setEnabled(false);
        jTextFieldTotalPago.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldTotalPagoActionPerformed(evt);
            }
        });

        jLabel6.setText("Total Exonerado");

        jTextFieldTotalExonerado.setEnabled(false);

        jButtonLimpiar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gif/escoba.png"))); // NOI18N
        jButtonLimpiar.setToolTipText("Limpiar");
        jButtonLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLimpiarActionPerformed(evt);
            }
        });

        jButtonRegresar2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gif/regresar.jpeg"))); // NOI18N
        jButtonRegresar2.setToolTipText("Regresar");
        jButtonRegresar2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRegresar2ActionPerformed(evt);
            }
        });

        jTextFieldExoneracion.setEnabled(false);

        jTextFieldTipoRecibo.setEnabled(false);

        jLabel7.setText("Funcionario");

        jTextFieldNombreFuncionario.setEnabled(false);

        javax.swing.GroupLayout jPanelFondoLayout = new javax.swing.GroupLayout(jPanelFondo);
        jPanelFondo.setLayout(jPanelFondoLayout);
        jPanelFondoLayout.setHorizontalGroup(
            jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFondoLayout.createSequentialGroup()
                .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelFondoLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldTipoRecibo, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldExoneracion, javax.swing.GroupLayout.PREFERRED_SIZE, 298, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelFondoLayout.createSequentialGroup()
                        .addGap(5, 5, 5)
                        .addComponent(jLabel2)
                        .addGap(14, 14, 14)
                        .addComponent(jTextFieldRecibo, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(117, 117, 117)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextFieldFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonRegresar, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelFondoLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldIdPagador, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldNombrePagador, javax.swing.GroupLayout.PREFERRED_SIZE, 341, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(jPanelFondoLayout.createSequentialGroup()
                .addComponent(jLabel18)
                .addGap(18, 18, 18)
                .addComponent(jTextFieldTotalPago, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldTotalExonerado, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(465, 465, 465))
            .addGroup(jPanelFondoLayout.createSequentialGroup()
                .addGap(111, 111, 111)
                .addComponent(jButtonLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonRegresar2, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(742, Short.MAX_VALUE))
            .addGroup(jPanelFondoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 1000, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jPanelFondoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldNombreFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 293, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(634, Short.MAX_VALUE))
        );
        jPanelFondoLayout.setVerticalGroup(
            jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFondoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jFormattedTextFieldFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButtonRegresar))
                    .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldRecibo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2)
                        .addComponent(jLabel3)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextFieldIdPagador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jTextFieldNombrePagador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel1)
                    .addComponent(jTextFieldExoneracion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldTipoRecibo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jTextFieldNombreFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jTextFieldTotalPago, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(jTextFieldTotalExonerado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelFondoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonRegresar2, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelFondo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelFondo, javax.swing.GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButtonRegresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRegresarActionPerformed

    this.dispose();
}//GEN-LAST:event_jButtonRegresarActionPerformed

private void jFormattedTextFieldFechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFormattedTextFieldFechaActionPerformed
}//GEN-LAST:event_jFormattedTextFieldFechaActionPerformed

private void jButtonRegresar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRegresar2ActionPerformed

    dispose();
}//GEN-LAST:event_jButtonRegresar2ActionPerformed

private void jTextFieldTotalPagoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldTotalPagoActionPerformed
}//GEN-LAST:event_jTextFieldTotalPagoActionPerformed

private void jButtonLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLimpiarActionPerformed

    Limpiar();

}//GEN-LAST:event_jButtonLimpiarActionPerformed

private void jTextFieldReciboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldReciboActionPerformed
    ValidarRecibos();
}//GEN-LAST:event_jTextFieldReciboActionPerformed

private void jTextFieldIdPagadorKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldIdPagadorKeyPressed
}//GEN-LAST:event_jTextFieldIdPagadorKeyPressed

private void jTextFieldIdPagadorControlActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldIdPagadorControlActionPerformed
}//GEN-LAST:event_jTextFieldIdPagadorControlActionPerformed

    private void ValidarRecibos() {
        try {
            LimpiarTable();

            String SidRecibo = this.jTextFieldRecibo.getText();
            if (SidRecibo == null || SidRecibo.equals("")) {
                JOptionPane.showMessageDialog(this, "Debe ingresar un numero de recibo ", "Mensaje", JOptionPane.WARNING_MESSAGE);
                return;
            }
            this.IdRecibo = Integer.parseInt(SidRecibo);
            recibesBeans.setIdRecibo(IdRecibo);
            if (recibesBeans.ConsultarRecibo() == true) {
                CargarRecibos();

            }

        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, "Error " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowGainedFocus
    // TODO add your handling code here:
}//GEN-LAST:event_formWindowGainedFocus

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new VerDetallesRecibosFrame().setVisible(true);
            }
        });
    }

    /*
     * 
     *verifica si ya se pago la placa para este año 
     * 
     */
    public void CargarRecibos() {
        try {

            if (recibesBeans.getId().equals("")) {
                JOptionPane.showMessageDialog(this, "Este recibo no tiene indicado quien lo pago", "Mensaje", JOptionPane.INFORMATION_MESSAGE);
                return;
            }

            this.jTextFieldIdPagador.setText(recibesBeans.getId());

            this.jTextFieldNombrePagador.setText(recibesBeans.getNombrePagador());
            this.jTextFieldExoneracion.setText(recibesBeans.getIdExonerado());
            this.jTextFieldTipoRecibo.setText(recibesBeans.getTipoRecibo());
           
            jTextFieldTotalPago.setText(sesion.getFormateador().format(recibesBeans.getTotalPagado()));
        
             jTextFieldTotalExonerado.setText(sesion.getFormateador().format(recibesBeans.getTotalExonerado()));
            jTextFieldNombreFuncionario.setText(recibesBeans.getNombreFuncionario());
            CargarDetallesRecibos();
            repaint();


        } catch (Exception ex) {
            sesion.MostrarMensajeError("Error ", "CargarContribuyentes()\n " + ex.getMessage().toString());
        }
    }

    private void Limpiar() {
        try {
            jTextFieldIdPagador.setText("");
            jTextFieldNombrePagador.setText("");

            jTextFieldExoneracion.setText("");
            jTextFieldRecibo.setText("");
            jTextFieldTotalPago.setText("");
            jTextFieldTotalExonerado.setText("");
            jTextFieldNombreFuncionario.setText("");
            LimpiarTable();
        } catch (Exception ex) {
            sesion.MostrarMensajeError("Error ", "Limpiar()\n " + ex.getMessage().toString());
        }
    }

    private void LimpiarTable() {
        try {
            //limpiar  el jXTable

            boolean control = false;
            while (control == false) {
                int n = jXTable1.getRowCount();
                //System.out.println("n" + n);
                if (n <= 0) {
                    control = true;
                } else {
                    modelo.removeRow(0);
                }

            }//while
        } catch (Exception ex) {
            sesion.MostrarMensajeError("Error ", "LimpiarTable()\n " + ex.getMessage().toString());
        }
    }

    /*
     *
     *Cargar
     *
     */
    private void AgregarFila() {
        try {
            Object[] filas = new Object[13]; // Hay tres columnas en la tabla
            rowComentario = "";
            filas[0] = new Boolean(false);
            filas[1] = rowIdRegimen;
            filas[2] = rowRegimen;
            filas[3] = rowSaldoAnterior;
            filas[4] = rowCantidad;
            filas[5] = rowPago;
            filas[6] = rowSaldo;
            filas[7] = rowExoneracion;
            filas[8] = rowEstatus;
            filas[9] = rowPeriodo;
            filas[10] = rowValor;
            filas[11] = rowSoloMorosidad;


            //  filas[9] = rowEsRecargo;

            filas[12] = rowComentario;




            modelo.addRow(filas);
        } catch (Exception ex) {
            sesion.MostrarMensajeError("Error ", "AgregarFila()\n " + ex.getMessage().toString());
        }
    }

    private void CargarDetallesRecibos() {
        try {

            recibesDetallesBeans.setIdRecibo(IdRecibo);
            recibesDetallesBeans.CargarDetallesRecibos();
            if (recibesDetallesBeans.getNumeroRegistrosLista() == - 1) {
                LimpiarTable();
                sesion.MostrarMensajeAdvertencia("Mensaje ", "No hay detalles de este recibo");
                return;
            }
            for (int i = 0; i <= recibesDetallesBeans.getNumeroRegistrosLista(); i++) {


                rowIdRegimen = recibesDetallesBeans.getListaIdRegimen().get(i);
                rowRegimen = recibesDetallesBeans.getListaRegimen().get(i);
                rowValor = recibesDetallesBeans.getListaValor().get(i);
                rowPago = recibesDetallesBeans.getListaPago().get(i);
                rowCantidad = recibesDetallesBeans.getListaCantidad().get(i);
                rowExoneracion = recibesDetallesBeans.getListaExoneracion().get(i);
                rowSaldo = recibesDetallesBeans.getListaSaldo().get(i);
                rowSaldoAnterior = recibesDetallesBeans.getListaSaldoAnterior().get(i);
                rowEsRecargo = recibesDetallesBeans.getListaEsRecargo().get(i);
                rowComentario = recibesDetallesBeans.getListaComentario().get(i);
                rowEstatus = recibesDetallesBeans.getListaEstatus().get(i);
                rowPeriodo = recibesDetallesBeans.getListaPeriodo().get(i);
                rowSoloMorosidad = recibesDetallesBeans.getListaSoloMorosidad().get(i);
                AgregarFila();
            }
        } catch (Exception ex) {
            sesion.MostrarMensajeError("Error ", "AgregarFila()\n " + ex.getMessage().toString());
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonLimpiar;
    private javax.swing.JButton jButtonRegresar;
    private javax.swing.JButton jButtonRegresar2;
    private javax.swing.JFormattedTextField jFormattedTextFieldFecha;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanelFondo;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextField jTextFieldExoneracion;
    private javax.swing.JTextField jTextFieldIdPagador;
    private javax.swing.JTextField jTextFieldNombreFuncionario;
    private javax.swing.JTextField jTextFieldNombrePagador;
    private javax.swing.JTextField jTextFieldRecibo;
    private javax.swing.JTextField jTextFieldTipoRecibo;
    private javax.swing.JTextField jTextFieldTotalExonerado;
    private javax.swing.JTextField jTextFieldTotalPago;
    private org.jdesktop.swingx.JXTable jXTable1;
    // End of variables declaration//GEN-END:variables
}
